<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>函数的调用</title>
</head>

<body>
    <p>九九乘法表：</p>
    <p>函数调用方法一：js代码调用。</p>
    <p>var cfb = function () {<br>
        &nbsp;&nbsp;&nbsp;&nbsp;for (var i = 1; i <= 9; i++) {<br>
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for (var j = 1; j <= i; j++) {<br>
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;document.write(j + " X " + i + "=" + j * i+ "&nbsp;&nbsp;&nbsp;&nbsp;")<br>
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;document.write("< br >");<br>
                &nbsp;&nbsp;&nbsp;&nbsp;}<br>
    }<br>
    //函数调用：<br>
    cfb();<br><br><br>运行结果：<br></p>
    <script>
        var cfb = function () {
            for (var i = 1; i <= 9; i++) {
                for (var j = 1; j <= i; j++) {
                    document.write(j + " X " + i + "=" + j * i+ "&nbsp;&nbsp;&nbsp;&nbsp;")
                }
                document.write("<br>");
            }
        }
        //函数的调用
        cfb();
        document.write("<br><br><br><br>");
        document.write("<p>函数调用方法二：函数的自我调用。</p>");
        document.write('<p style="color:red;">语法：(函数)();<br>(函数)：相当于函数名；()：函数后面的括号。</p>')
        document.write('<p>(function () {</p>&nbsp;&nbsp;&nbsp;&nbsp;for (var i = 1; i <= 9; i++) {</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for (var j = 1; j <= i; j++) {</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;document.write(j + " X " + i + "=" + j * i+ "&nbsp;&nbsp;&nbsp;&nbsp;")</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;document.write("< br >");</p>&nbsp;&nbsp;&nbsp;&nbsp;}</p>})();</p>');
        document.write("运行结果：<br>");
        //函数的自我调用
        (function () {
            for (var i = 1; i <= 9; i++) {
                for (var j = 1; j <= i; j++) {
                    document.write(j + " X " + i + "=" + j * i+ "&nbsp;&nbsp;&nbsp;&nbsp;")
                }
                document.write("<br>");
            }
        })();
    </script>
</body>

</html>